#include <iostream>
#include <set>
#include <vector>

using namespace std;

template<typename Container>
void display(Container &con){
    for(auto &ele:con){
        cout << ele << " ";
    }
    cout << endl;
}

void test(){
    set<int> number1;
    set<int> number2 = {1,2,8};
    number1 = number2;

    set<int> number3(number2);

    int arr[6] = {1,2,3,4,5,6};
    set<int> number4(arr,arr+6);


    vector<int> vec = {2,0,0,4,1,2,8};
    set<int> number5(vec.begin(),vec.end());

#if 0
    size_t ret = number2.count(2);
    cout << ret << endl;
    cout << number5.count(3)<< endl;
    /* display(number5); */
#endif 

#if 0 
    auto it = number1.find(8);
    if(it != number1.end()){
        cout << "元素存在" << endl;
        cout << "*it = " << *it << endl;
    }else{
        cout << "元素不存在" << endl;
    }
#endif 


    auto it1 = number1.insert(3);
    if(it1.second){
        cout << "success" << endl;
    }else {
        cout << "error" << endl;
    }

    number1.insert({2,3,6,7,8,88,99,9});


    vector<int> vec1 = {11,22,33,44,55};
    number1.insert(vec1.begin(),vec1.end());

#if 0
    cout << endl << "set不支持下标" << endl;
    cout << "number1[0] = " << number1[0] << endl;//error

    cout << endl << endl;
    auto it = number1.begin();
    ++it;
    cout << "*it = " << *it << endl;
    /* *it = 300;//error，不支持使用迭代器进行修改元素 */
#endif 

    display(number1);


}

int main()
{
    test();
    return 0;
}
